{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=157
  Verdict: Accepted
}
uses 
	SysUtils, Math;
 
var
	n,m,i,s,ans,ss,cur:longint;
	a,b,c:array[0..40] of int64;
 
procedure sort(l,r:longint);
 
var
	i,j:longint;
	x,y:int64;
 
begin
i:=l;
j:=r;
x:=b[(l+r) div 2];
repeat
	while b[i]<x do inc(i);
	while b[j]>x do dec(j);
	if i<=j then begin
		y:=b[i];
		b[i]:=b[j];
		b[j]:=y;
		inc(i);
		dec(j);
	end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
 
procedure go(i:longint);
 
var
	j:longint;
 
begin
for j:=1 to 3 do begin 
	if j=2 then begin
		inc(ss,a[i]);
		inc(cur);
		c[cur]:=a[i];
	end else
	if j=3 then begin
		inc(ss,a[i]+a[i]);
		inc(cur);
		c[cur]:=a[i];
		inc(cur);
		c[cur]:=a[i];
	end;
	if ss=n then begin
		if cur<ans then begin
			b:=c;
			ans:=cur;
		end;
	end;
	if i<m then
		go(i+1);
	if j=2 then begin
		dec(cur);
		dec(ss,a[i]);
	end else
	if j=3 then begin
		dec(cur,2);
		dec(ss,a[i]+a[i]);
	end;
end;
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
fillchar(c,sizeof(c),0);
read(n,m);
s:=0;
for i:=1 to m do begin
	read(a[i]);
	inc(s,a[i]);
end;
if s*2<n then write(-1) else
if s*2=n then begin
	writeln(2*m);
	for i:=1 to m do
		write(a[i],' ',a[i],' ');
end else begin
	ans:=maxlongint;
	cur:=0;
	ss:=0;
	go(1);
	if ans<>maxlongint then begin
		writeln(ans);
		sort(1,ans);
		for i:=1 to ans do
			write(b[i],' ');
	end else write(0);
end;
end.